// hyy
export default function MapLoader() {
  return new Promise((resolve, reject) => {
    if (window.AMap) {
      resolve(window.AMap);
    } else {
      var script = document.createElement("script")
      script.type = "text/javascript";
      script.async = true;
      script.src =
        "https://webapi.amap.com/maps?v=1.4.15&callback=initAMap&key=5bdc11831e9b97e5257eea8bbbb02d8f&plugin=AMap.ToolBar,AMap.IndoorMap,AMap.Driving,AMap.Transfer,AMap.Walking"
      script.onerror = reject;
      document.head.appendChild(script);
    }
    window.initAMap = () => {
      resolve(window.AMap)
    }
  })
}
